﻿@using System.Text
@using OA.Model
@using OA.AspNetCore.Html
@using OA.Core.Model
@using OA.Core.Helper

@model PageList<SimpleTestPaper>
@{
    ViewBag.Title = "试卷列表";
    Layout = "~/Areas/Member/Views/Shared/_Layout.cshtml";
}

<div class="layui-tab layui-tab-brief" lay-filter="user">
    <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 5px 0;">
        <form action="" class="layui-form">
            <div class="layui-inline">
                <label class="layui-form-label" style="width: auto; padding-right: 5px;">名称筛选：</label>
                <div class="layui-input-inline">
                    <input type="text" name="keyWord" class="layui-input">
                </div>
                <button type="button" class="layui-btn searchButton">搜索</button>
                <a class="layui-btn" href="javascript:ShowPage('/Management/TestPaper/Create','添加试卷',7)">添加试卷</a>
            </div>
        </form>
    </div>
    <table class="layui-table" lay-data="{url:'GetData', cellMinWidth: 80, page: true,limit:15}" id="resultList" lay-filter="resultList">
        <thead>
            <tr>
                <th lay-data="{field:'ID', width:70}">编号</th>
                <th lay-data="{field:'Title'}">名称</th>
                <th lay-data="{field:'Score', width:80}">总分</th>
                <th lay-data="{field:'StartTime', width:170}">开始时间</th>
                <th lay-data="{field:'EndTime', width:170}">结束时间</th>
                <th lay-data="{fixed:'right', width:180, align:'center', toolbar: '#barDemo',width:480}">操作</th>
            </tr>
        </thead>
    </table>
    <script type="text/html" id="barDemo">
        <a class="layui-btn layui-btn-primary layui-btn-xs" href="javascript:ShowPage('/Management/TestPaper/ShowTestPaper?id={{d.ID}}','查看投票')">查看</a>
        <a class="layui-btn layui-btn-primary layui-btn-xs" href="javascript:ShowPage('/Management/TestPaper/Statistics?id={{d.ID}}','查看统计')">查看统计</a>
        <a class="layui-btn layui-btn-primary layui-btn-xs" href="javascript:ShowPage('/Management/TestPaper/SetEmployees?id={{d.ID}}','指定考试成员')">指定考试成员</a>
        <a class="layui-btn layui-btn-primary layui-btn-xs" href="javascript:ShowPage('/Management/TestPaper/Edit?id={{d.ID}}','修改考试',7)">修改考试</a>
        <a class="layui-btn layui-btn-primary layui-btn-xs" href="javascript:ShowPage('/Management/TestPaper/ShowItems?id={{d.ID}}','编辑表单项')">编辑表单项</a>
        <span class="layui-btn layui-btn-primary layui-btn-xs" onclick="DeleteItem('{{d.ID}}')">删除</span>

    </script>
    <script type="text/javascript">
        function DeleteItem(id) {
            layer.confirm('您正在进行删除投票操作', {
                btn: ['是的,我要删除该投票', '不小心点错了'] //按钮
            }, function () {
                var url = "/Management/TestPaper/Delete?id=" + id;
                $.getJSON(url, function (data) {
                    if (data.State === 200) {
                        layer.msg(data.Msg);
                        $(".layui-laypage-btn")[0].click();
                    }
                    else {
                        layer.msg(data.Message);
                    }
                });
            }, function () {

            });
        }
    </script>

